/* -----------------------------------------------------------------------------
 * PROJECT    : net.lwf
 * FILE       : FillBlanksAction.java
 *
 * HISTORY:
 * Date          Author                        Description
 * ----------------------------------------------------------------------------- 
 * Dec 2, 2008       Raghu Sarraff			       Created
 */
package lwf.web.struts.action.english;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import lwf.handler.english.FillBlanksHandler;
import lwf.web.struts.action.WorkSheetAction;

import net.lwf.web.constant.IPageTitle;
import net.lwf.web.constant.IWebConstant;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;


/**
 * Type the class description here
 *  
 */
public class FillBlanksAction extends WorkSheetAction {
	
	public ActionForward home(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		return mapping.findForward("home");
	} //home	
	

	public ActionForward selectoperation(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String filltype = request.getParameter(IWebConstant.FILL_TYPE);
		FillBlanksHandler sumdetails = new FillBlanksHandler(filltype);
		//set to session
		setSumData(request, sumdetails);
		// Write the HTML to response
		response.setContentType("text/html");
		PrintWriter out = response.getWriter();
		out.println(sumdetails.getDisplayFormatter().getFormattedQuestion());
		//the html string value will be retrieved as 'req.responseText'
		// and will be displayed using the element id = questionblock
		out.flush();
		return null; // Not forwarding to anywhere, response is fully-cooked
	}
	
	@Override
	public String getPageTitle() {
		return IPageTitle.FILL_IN_THE_BLANKS;
	}

	@Override
	public String getMainTitle() {
		return null;
	}

	@Override
	public String getPdfLink() {
		return null;
	}

	@Override
	public String getQuizLink() {
		return null;
	}

}

